import com.sun.jna.*;
import com.sun.jna.platform.win32.WinDef;

public interface CLibrary extends Library {

    CLibrary INSTANCE = Native.load("sentry", CLibrary.class);
// C:\Users\Roy\workspace\crashDemo\src\sentry.dll
//    CLibrary INSTANCE = Native.loadLibrary("C:\\Users\\Roy\\workspace\\crashDemo\\src\\sentry", CLibrary.class);

    Pointer sentry_options_new();

    void sentry_options_set_dsn(Pointer opts, String dsn);

    void sentry_options_set_handler_path(Pointer opts, String path);

    int sentry_init(Pointer opts);

    int sentry_close();

    SENTRY_VALUE.ByValue sentry_value_new_message_event(int level, String logger, String message);

    SENTRY_UUID.ByValue sentry_capture_event(SENTRY_VALUE.ByValue event);

    /**
     * typedef struct sentry_uuid_s {
     * char bytes[16];
     * } sentry_uuid_t;
     */
    @Structure.FieldOrder({"bytes"})
    class SENTRY_UUID extends Structure {

        public static class ByValue extends SENTRY_UUID implements Structure.ByValue {}

        public byte[] bytes = new byte[16];

    }

    class SENTRY_VALUE extends Union {

        public static class ByValue extends SENTRY_VALUE implements Structure.ByValue {}

        public WinDef.ULONGLONG _bits;
        public double _double;
    }

    public static interface SENTRY_LEVEL {
        int SENTRY_LEVEL_DEBUG = -1;
        int SENTRY_LEVEL_INFO = 0;
        int SENTRY_LEVEL_WARNING = 1;
        int SENTRY_LEVEL_ERROR = 2;
        int SENTRY_LEVEL_FATAL = 3;
    }

}
